<template>
  <div>
    <div v-for="(item, index) in arr" :key="index">
      <input type="checkbox" :value="item" v-model="newArr">{{item}}
    </div>
    <br>
    选中的数求和：{{sum}}
  </div>
</template>

<script>
export default {
  data () {
    return {
      arr: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
      newArr: []
    }
  },

  computed: {
    sum: function () {
      return this.newArr.reduce((num, item) => {
        num += item
        return num
      }, 0)
    }
  },

  created () {

  },

  methods: {

  }
}
</script>

<style scoped lang='less'>
  div {
    display: inline-block;
  }
</style>
